﻿using Api.Code;
using System.Web.Http;
using System.Net;

namespace Api.OrderFood
{
    public abstract class ApiControllerBase : ApiController
    {
        protected virtual IHttpActionResult Success()
        {
            return Content(System.Net.HttpStatusCode.OK, new AjaxResult { code = ReturnCode.SUCCESS, state = ResultType.success.ToString() });
        }
        protected virtual IHttpActionResult Success(object data)
        {
            return Content(System.Net.HttpStatusCode.OK, new AjaxResult { code = ReturnCode.SUCCESS, state = ResultType.success.ToString(), data = data });
        }
        protected virtual IHttpActionResult Error(ReturnCode returncode)
        {
            return Content(System.Net.HttpStatusCode.NotImplemented, new AjaxResult { code = returncode, state = ResultType.error.ToString() });
        }
    }
}
